home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 June / SGI Freeware 1998 June.iso / dist / fw_UMINNgopher.idb / usr / freeware / src / gopher_1.12 / gopher / CURcurses.h.z / CURcurses.h
C/C++ Source or Header  |  1997-09-09  |  4KB  |  145 lines

  1. /********************************************************************
  2.  * $Author: drich $
  3.  * $Revision: 1.1 $
  4.  * $Date: 1995/10/03 04:07:54 $
  5.  * $Source: /proj/freeware1.0/gopher1.12/src/gopher/RCS/CURcurses.h,v $
  6.  * $State: Exp $
  7.  *
  8.  * Paul Lindner, University of Minnesota CIS.
  9.  *
  10.  * Copyright 1991, 1992 by the Regents of the University of Minnesota
  11.  * see the file "Copyright" in the distribution for conditions of use.
  12.  *********************************************************************
  13.  * MODULE: CURcurses.h
  14.  * Header file access methods for CURcurses.c
  15.  *********************************************************************
  16.  * Revision History:
  17.  * $Log: CURcurses.h,v $
  18.  * Revision 1.1  1995/10/03  04:07:54  drich
  19.  * gopher 1.2 check-in
  20.  *
  21.  * Revision 1.2  1992/12/31  05:57:38  lindner
  22.  * Mods for VMS
  23.  *
  24.  * Revision 1.1  1992/12/10  23:32:16  lindner
  25.  * gopher 1.1 release
  26.  *
  27.  * Revision 1.1  1992/12/10  06:16:51  lindner
  28.  * Initial revision
  29.  *
  30.  *
  31.  *********************************************************************/
  32.  
  33. #include <ctype.h>
  34.  
  35. #if defined(ultrix)
  36. #  include <cursesX.h>
  37. #else
  38. #  include <curses.h>
  39. #endif
  40.  
  41. #include "boolean.h"
  42. #include "STRstring.h"
  43.  
  44. #ifdef KEY_RIGHT
  45. #define SYSVCURSES
  46. #endif
  47.  
  48. struct CursesStruct {
  49.      WINDOW *Screen;
  50.      String *Termtype;
  51.  
  52.      /** Termcap/terminfo stuff **/
  53.      String *Clearscreen;
  54.      String *AudibleBell;
  55.      String *Highlighton;
  56.      String *Highlightoff;
  57.      
  58.      boolean inCurses;
  59.      
  60.      int COLS;
  61.      int ROWS;
  62.      
  63.      void (*sigtstp)();
  64.      void (*sigwinch)();
  65. };
  66.  
  67. typedef struct CursesStruct CursesObj;
  68. typedef struct CursesStruct *CursesObjp;
  69.  
  70. #ifndef SYSVCURSES
  71. #define KEY_DOWN        0402           /* The four arrow keys ...*/
  72. #define KEY_UP          0403
  73. #define KEY_LEFT        0404
  74. #define KEY_RIGHT       0405           
  75. #define KEY_NPAGE       0522           /* Next page */
  76. #define KEY_PPAGE       0523           /* Previous page */
  77. #define KEY_ENTER       0527
  78. #define KEY_BACKSPACE   0407
  79. #endif
  80.  
  81. /*
  82.  * Definitions for character graphics
  83.  */
  84.  
  85. #if defined(SYSVCURSES) && !defined(ultrix) && !defined(hpux) && !defined(_AUX_SOURCE)
  86. #define BOX_UL          ('l'|A_ALTCHARSET)
  87. #define BOX_UR          'k'|A_ALTCHARSET
  88. #define BOX_LL          'm'|A_ALTCHARSET
  89. #define BOX_LR          'j'|A_ALTCHARSET
  90. #define BOX_VLINE       'x'|A_ALTCHARSET
  91. #define BOX_HLINE       'q'|A_ALTCHARSET
  92. #else
  93. #define BOX_UL          '+'
  94. #define BOX_UR          '+'
  95. #define BOX_LL          '+'
  96. #define BOX_LR          '+'
  97. #define BOX_VLINE       '|'
  98. #define BOX_HLINE       '-'
  99. #endif
  100.  
  101. #if defined(VMS) || defined(__convex__) || defined(sequent)
  102. #if !defined(cbreak)
  103. #define cbreak crmode
  104. #endif
  105. #endif
  106.  
  107.  
  108. /*
  109.  * access functions
  110.  */
  111.  
  112. #define CURgetScreen(a)    ((a)->Screen)
  113. #define CURgetTerm(a)      (STRget((a)->Termtype))
  114. #define CURgetCLS(a)       (STRget((a)->Clearscreen))
  115. #define CURgetBell(a)      (STRget((a)->AudibleBell))
  116. #define CURgetHighon(a)    (STRget((a)->Highlighton))
  117. #define CURgetHighoff(a)   (STRget((a)->Highlightoff))
  118.  
  119. #ifdef VMS
  120. #define CURsetScreen(a,b)  ((b),(a)->Screen=stdscr)
  121. #else
  122. #define CURsetScreen(a,b)  ((a)->Screen=(b))
  123. #endif
  124. #define CURsetTerm(a,b)    (STRset((a)->Termtype, (b)))
  125. #define CURsetCLS(a,b)     (STRset((a)->Clearscreen,(b)))
  126. #define CURsetBell(a,b)    (STRset((a)->AudibleBell,(b)))
  127. #define CURsetHighon(a,b)  (STRset((a)->Highlighton,(b)))
  128. #define CURsetHighoff(a,b) (STRset((a)->Highlightoff,(b)))
  129. #define CURsetSIGTSTP(a,b) ((a)->sigtstp=(b))
  130. #define CURsetSIGWINCH(a,b) ((a)->sigwinch=(b))
  131.  
  132.  
  133. CursesObj *CURnew();
  134. void      CURinit();
  135. void      CURcenterline();
  136. void      CURenter();
  137. void      CURexit();
  138. int       CURgetstr();
  139. int       CURgetch();
  140. void      CURresize();
  141. int       CURoutchar();
  142. int       CURGetOneOption();
  143. void      CURBeep();
  144. void      CURwenter();
  145.